/**
 * Created by Administrator on 2017/5/3 0003.
 */
var MyMC={
    create:function (arr_assets) {
        var mc={};
        var time;

        console.log(arr_assets[0])
        console.log(resource)
        mc.ui=new PIXI.Sprite(resource[arr_assets[0]].texture);

        mc.play=function (frameRate) {
            var i=0;
            time=setInterval(function () {
                i++;
                if(i<=arr_assets.length-1)
                {
                    mc.ui.texture=resource[arr_assets[i]].texture;
                }
                else
                {
                    document.dispatchEvent(new CustomEvent('MC_Complete',{detail:mc.id}))
                    clearInterval(time);
                }
            },1000/frameRate)
        };
        mc.reversePlay=function (frameRate) {
            var i=arr_assets.length-1;
            time=setInterval(function () {
                console.log('reverse')
                i--;
                if(i>=5)
                {
                    mc.ui.texture=resource[arr_assets[i]].texture;
                }
                else
                {
                    document.dispatchEvent(new CustomEvent('MC_Reverse',{detail:mc.id}))
                    clearInterval(time);
                }
            },1000/frameRate)
        }

        return mc;
    }
}